﻿using UnityEngine;
using System.Collections;

public class AxeSpinner : MonoBehaviour {
	
	public float spinSpeed;
	public float moveSpeed;
	public Transform axe;

	void Start(){
		if(moveSpeed<0){
			axe.transform.Rotate(new Vector3(0,180,0));
			spinSpeed -=180; 
		}
	}

	void Update () {
		transform.Translate(transform.right * moveSpeed * Time.deltaTime);
		axe.Rotate(new Vector3(0, 0, -spinSpeed * Time.deltaTime));
		
	}


	void OnTriggerEnter(Collider other) {
		if (other.gameObject.tag != "Player" && other.gameObject.tag != "ThrowingAxe") {
			Destroy(gameObject);
		}
	}
}
